package com.yanqu.road.server.cmd.orewar;

import com.yanqu.road.pb.orewar.OreWarProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.orewar.CrossOreWarMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;



@Cmd(code = Protocol.C_CROSS_OREWAR_GET_ALL_USERPIT, desc = "所有玩家的坑位信息")
public class CrossGetAllUserPitCmd extends CrossUnionCommand {

    private int activityId;

    private int pitId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        OreWarProto.CrossGetAllUserPitMsg reqMsg = OreWarProto.CrossGetAllUserPitMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        pitId = reqMsg.getPitId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        if(pitId == 0){
            CrossOreWarMgr.sendAllUserPit(activityId,serverId);
        }else{
            CrossOreWarMgr.syncUserPit(activityId,serverId,pitId);
        }
    }

    @Override
    public void sendData() {

    }

}
